package org.chench.test.configclient.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope  // 为了使客户端刷新配置信息之后更新绑定的参数值，必须使用该注解
@RestController
public class ConfigClientController {
    @Value("${from}")
    private String from;

    // 获取配置参数from
    @GetMapping("/from")
    public String foo()  {
        return from;
    }
}
